package com.cunshe.web.manage;

import com.cunshe.common.ResponseVO;
import com.cunshe.config.annotation.Login;
import com.cunshe.domain.HomeBanner;
import com.cunshe.service.HomeBannerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 首页图片2
 * @author 
 */
@Api(tags = "首页图片2")
@Login
@RestController
@RequestMapping(value = "/manage/homeBanner")
public class HomeBannerController {

    @Autowired
    private HomeBannerService homeBannerService;

    @ApiOperation(value = "新增")
    @PostMapping(value = "insert")
    public ResponseVO insert(@RequestBody HomeBanner record) {
        homeBannerService.insert(record);
        
        return ResponseVO.success();
    }

    @ApiOperation(value = "删除")
    @PostMapping(value = "delete")
    public ResponseVO delete(@RequestParam("id") Long id) {
        int delete = homeBannerService.delete(id);
        
        return ResponseVO.success();
    }

    @ApiOperation(value = "修改")
    @PostMapping(value = "update")
    public ResponseVO update(@RequestBody HomeBanner record) {
        int update = homeBannerService.update(record);
        
        return ResponseVO.success();
    }

    @ApiOperation(value = "查询")
    @PostMapping(value = "get")
    public ResponseVO<HomeBanner> get(@RequestParam("id") Long id) {
        HomeBanner homeBanner = homeBannerService.get(id);
        return ResponseVO.success(homeBanner);
    }

    @ApiOperation(value = "查询所有")
    @PostMapping(value = "all")
    public ResponseVO<List<HomeBanner>> all() {
        List<HomeBanner> list = homeBannerService.all();
        return ResponseVO.success(list);
    }

}